import { Component } from "react";
import { Route, Switch } from "react-router-dom";

import A from "./A";
import B from "./B";

export default class Home extends Component {
  render() {
    return (
      <div>
        <h1>Home</h1>

        <hr />

        {/* 
          根据 url 来渲染 A or B
          
          /home/a  => A
          /home/b  => B
        */}
        <Switch>
          <Route path="/home/a" component={A} />
          <Route path="/home/b" component={B} />
        </Switch>
      </div>
    );
  }
}
